package components.brush {
	import UIUtils.uif_util;
	
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.geom.Matrix;
	import flash.geom.Rectangle;

	public class c_spotBrush extends c_baseBrush {
		public static var DEFAULTRADIUS: Number = 10;
		
		private var _radius: Number;
		
		public function c_spotBrush() {
			super();
			radius = DEFAULTRADIUS;
		}
		
		public function get radius(): Number {
			return _radius;
		}
		
		public function set radius(a_radius: Number): void {
			_radius = a_radius;
			stepLen = Math.ceil(_radius / 4);
			stamp = createSpotStamp(_radius, 1);
		}
		
		override public function get bounds():Rectangle {
			return new Rectangle(-radius, -radius, radius * 2, radius * 2);
		}
		
		override public function createStampImage(): BitmapData {
			var a_bounds: Rectangle = bounds;
			var image: BitmapData = new BitmapData(a_bounds.width, a_bounds.height, true, 0);
			var mat: Matrix = new Matrix();
			var spot: Shape = new Shape();
			spot.graphics.lineStyle(1, 0, 1);
			spot.graphics.drawCircle(0, 0, radius);
			mat.translate(-a_bounds.x, -a_bounds.y);
			image.draw(spot, mat);
			return image;
		}		
	}
}